package com.yaoli.ajob;

/**
 * 不用看
 *
 * 非常简单
 *
 * Created by will on 2017/4/16.
 */
public class _151_ReverseWordsinaString {
    public static void main(String[] args) {
        String s = "   a   b ";
        String [] str = s.split(" ");
        StringBuilder sb = new StringBuilder("");

        for(int i = str.length - 1 ; i >= 0 ; i--){
            if(!str[i].equals("")){
                if(i == str.length - 1){
                    sb.append(str[i]);
                }else{
                    sb.append(" "+str[i]);
                }

            }
        }
        System.out.println("");
        //return sb.toString();
    }
}
